package com.bawei.day0129.view.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.bawei.day0129.R;
import com.bawei.day0129.base.BaseActivity;
import com.bawei.day0129.databinding.ActivityWecomeBinding;
import com.bawei.day0129.viewmodel.MainViewModel;

public class WecomeActivity extends BaseActivity<MainViewModel, ActivityWecomeBinding> {


    @Override
    protected int initLayout() {
        return R.layout.activity_wecome;
    }

    @Override
    protected void initView() {
        myCountDownTimer myCountDownTimer = new myCountDownTimer(4000, 1000);
        myCountDownTimer.start();
    }


    class myCountDownTimer extends CountDownTimer {

        public myCountDownTimer(long millisInFuture, long countDownInterval) {
            super(millisInFuture, countDownInterval);
        }

        @Override
        public void onTick(long l) {
            dataBinding.but.setText(l / 1000 + "s跳过");
        }

        @Override
        public void onFinish() {
            dataBinding.but.setText("0s跳过");
            startActivity(new Intent(WecomeActivity.this, CommeActivity.class));
            finish();
        }
    }
}